<h1>Manage Admins</h1>
	
<fieldset style="border: 1px solid #dedede;">
<legend>Add admin</legend>	
<?php $this->load->helper('form'); echo form_open('', array('id'=>'main_form')) ?>		
<input type="hidden" id="admin_id" name="admin_id" value="<?=$account->id?>" />
	
<table class="greentable">
	<tr id="form-item_username">
			<td width="200">Username</td>
			<td><input style="width:175px" type="text" id="username" name="username" value="<?=$account->username?>" /><p class="error_descr"></p></td>
	</tr>
	<tr id="form-item_password">
			<td width="200">New Password <br><small>(leave blank to keep unchanged)</small></td>
			<td><input style="width:175px" type="password" id="password" name="password" value="" /><p class="error_descr"></p></td>
	</tr>
	<tr id="form-item_password2">
			<td width="200">Confirm password</td>
			<td><input style="width:175px" type="password" id="password2" name="password2" value="" /><p class="error_descr"></p></td>
	</tr>
	<tr id="form-item_email">
			<td width="200">E-mail</td>
			<td><input style="width:175px" type="text" id="email" name="email" value="<?=$account->email?>" /><p class="error_descr"></p></td>
	</tr>
</table>

<fieldset id="perms" style="border: 1px solid #dedede;">
<legend>Permissions</legend>
<?php
	$acl = json_decode($account->acl, true);
?>	
<table class="greentable">
	<tr>
			<td width="200">Edit user info</td>
			<td>
					<input type="radio" name="acl[user_edit]" value="yes" <?=@$acl['user_edit']=='yes'?'checked="checked"':''?>/> Yes
					<input type="radio" name="acl[user_edit]" value="no" <?=@$acl['user_edit']!='yes'?'checked="checked"':''?>/> No
			</td>
	</tr>
	<tr>
			<td width="200">Delete user record</td>
			<td>
				<input type="radio" name="acl[user_delete]" value="yes" <?=@$acl['user_delete']=='yes'?'checked="checked"':''?>/> Yes
				<input type="radio" name="acl[user_delete]" value="no" <?=@$acl['user_delete']!='yes'?'checked="checked"':''?>/> No
			</td>
	</tr>
	<tr>
			<td width="200">Export users</td>
			<td>
				<input type="radio" name="acl[user_export]" value="yes" <?=@$acl['user_export']=='yes'?'checked="checked"':''?>/> Yes
				<input type="radio" name="acl[user_export]" value="no" <?=@$acl['user_export']!='yes'?'checked="checked"':''?>/> No
			</td>
	</tr>
	<tr>
			<td width="200">Import users</td>
			<td>
				<input type="radio" name="acl[user_import]" value="yes" <?=@$acl['user_import']=='yes'?'checked="checked"':''?>"/> Yes
				<input type="radio" name="acl[user_import]" value="no" <?=@$acl['user_import']!='yes'?'checked="checked"':''?>/> No
			</td>
	</tr>
	<tr>
			<td width="200">Send e-mail</td>
			<td>
				<input type="radio" name="acl[send_email]" value="yes" <?=@$acl['send_email']=='yes'?'checked="checked"':''?>/> Yes
				<input type="radio" name="acl[send_email]" value="no" <?=@$acl['send_email']!='yes'?'checked="checked"':''?>/> No
			</td>
	</tr>
	<tr>
			<td width="200">Edit settings</td>
			<td>
				<input type="radio" name="acl[settings_edit]" value="yes" <?=@$acl['settings_edit']=='yes'?'checked="checked"':''?>/> Yes
				<input type="radio" name="acl[settings_edit]" value="no" <?=@$acl['settings_edit']!='yes'?'checked="checked"':''?>/> No
			</td>
	</tr>
	<tr>
			<td width="200">Create admin</td>
			<td>
				<input type="radio" name="acl[admin_create]" value="yes" <?=@$acl['admin_create']=='yes'?'checked="checked"':''?>/> Yes
				<input type="radio" name="acl[admin_create]" value="no" <?=@$acl['admin_create']!='yes'?'checked="checked"':''?>/> No
			</td>
	</tr>
	<tr>
			<td width="200">Edit admin</td>
			<td>
				<input type="radio" name="acl[admin_edit]" value="yes" <?=@$acl['admin_edit']=='yes'?'checked="checked"':''?>/> Yes
				<input type="radio" name="acl[admin_edit]" value="no" <?=@$acl['admin_edit']!='yes'?'checked="checked"':''?>/> No
			</td>
	</tr>
	<tr>
			<td width="200">Delete admin</td>
			<td>
				<input type="radio" name="acl[admin_delete]" value="yes" <?=@$acl['admin_delete']=='yes'?'checked="checked"':''?>/> Yes
				<input type="radio" name="acl[admin_delete]" value="no" <?=@$acl['admin_delete']!='yes'?'checked="checked"':''?>/> No
			</td>
	</tr>
</table>
</fieldset>

<?php echo form_close() ?>
	<div style="text-align:center;">
		<table cellspacing="0" cellpadding="4">
		<tr>
				<td>
					<span id="save-stat" style="color:orange;font-weight:bold;display:none;"></span>
					<input type="submit" id="bt-save" value="Save Changes" class="submit" />
				</td>
		</tr>
		</table>
	</div>
</fieldset>



	<script src="<?php echo $base_url; ?>js/validation.js"></script>
	<script src="<?php echo $base_url; ?>js/admin_mgt.js"></script>
	<script language="javascript">
				
				jQuery(document).ready(function() {
						jQuery('#bt-save').click(function(event){
								GolderMarkets.AdminMgt.editAdmin();
						});
						jQuery('#main_form').submit(function(){
								return GolderMarkets.AdminMgt.editAdmin();
						});
				});
	</script>

